package org.gdstash.character;

import org.gdstash.file.GDReader;
import org.gdstash.file.GDWriter;

import java.io.IOException;

public class GDCharSkillMap {
    private String skill;
    private int active;

    public GDCharSkillMap() {
        this.skill = null;
        this.active = 0;
    }

    public void read() throws IOException {
        this.skill = GDReader.readEncString();
        this.active = GDReader.readEncInt(true);
    }

    public void write() throws IOException {
        GDWriter.writeString(this.skill);
        GDWriter.writeInt(this.active);
    }

    public int getByteSize() {
        int size = 0;
        size += 4;
        if (this.skill != null) {
            size += this.skill.length();
        }
        size += 4;
        return size;
    }
}
